import { Message } from '@element-plus/icons-vue'
import axios from 'axios'
import router from '../router'
const service = axios.create({
  baseURL: 'http://wechat.5656dh.com',
  withCredentials: true
})

service.interceptors.response.use(function (res) {
  if (res.data.code === 401) {
    Message.error('登录失效！')
    router.push('/')
  }
  return res.data
})
export default service
